<template>
	<view class="wap">
		<navbar :parameter='parameter'></navbar>
		<view class="box form">
			<!-- 姓名 年龄 学历 电话 邮箱 城市 自身优势      -->
			<view class="line acea-row">
				<view class="tit"> 姓名 </view>
				<input type="text" v-model="list.name" placeholder="请输入姓名" placeholder-class="psc">
			</view>
			<view class="line acea-row">
				<view class="tit"> 年龄 </view>
				<input type="number" v-model="list.age" placeholder="请输入年龄" placeholder-class="psc">
			</view>
			<view class="line acea-row">
				<view class="tit"> 学历 </view>
				<input type="text" v-model="list.education" placeholder="请输入学历" placeholder-class="psc">
			</view>
			<view class="line acea-row">
				<view class="tit"> 手机号 </view>
				<input type="number" v-model="list.mobile" placeholder="请输入手机号" placeholder-class="psc">
			</view>
			<view class="line acea-row">
				<view class="tit"> 邮箱 </view>
				<input type="text" v-model="list.email" placeholder="请输入邮箱" placeholder-class="psc">
			</view>
			<view class="line acea-row picker" @click="hospital_picker_show = true">
				<view class="tit"> 城市 </view>
				<picker @change="bindPickerChange" :value="index" mode=region>
					<view class="uni-input" :class="city == ''?'psc':''">{{city == ''?'请选择城市':city}}
					</view>
				</picker>
			</view>
			<view class="line acea-row">
				<view class="tit"> 自身优势 </view>
				<textarea v-model="list.adventages" placeholder="请简单的描述下自身的优势" placeholder-class="psc" />
			</view>
		</view>
		<view class="bottom-box">
			<view class="btn-box">
				<view class="btn" @click="submit"> 申请成为合伙人</view>
			</view>
		</view>


		<!-- 提示 -->
		<u-toast ref="uToast"></u-toast>
		<login :isAuto="false" ref="mySon" @phone_show="phone_show"></login>
		<phone :isShow="isShow2" @close="close2" @chamgs="chamgs2"></phone>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				parameter: {
					'navbar': '1',
					'return': '1',
					'title': '成为合伙人',
					'color': false,
				},
				index: '',
				list: {
					name: '',
					age: '',
					mobile: '',
					education: '',
					email: '',
					city: '',
					adventages: '',
				},
				city: '',
				isShow2: false,

			};
		},
		onLoad() {

		},
		onShow() {

		},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {

		},
		onShareTimeline(res) { //分享到朋友圈

		},

		methods: {
			async partner() {
				this.list.openid = uni.getStorageSync('openid')
				var that = this;
				const res = await this.$myRequest({
					url: '/api/user/partner',
					data: that.list
				})
				if (res.data.status == 200) {
					this.$refs.uToast.show({
						type: 'success',
						message: '提交成功',
						complete() {
							uni.navigateBack()
						}
					})
				}
			},
			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.detail.value)
				this.index = e.detail.value;
				this.city = e.detail.value[0] + e.detail.value[1] + e.detail.value[2];
				this.list.city = e.detail.value[1];
			},
			phone_show() {
				this.isShow2 = true;
			},
			close2() {
				this.isShow2 = false
				this.userInfos();
			},
			submit() {
				var openid = uni.getStorageSync('openid');
				if (openid) {
					this.partner();
				} else {
					this.$refs.mySon.login();
				}

			},


		}
	}
</script>

<style lang="scss" scoped>
	.wap {
		padding: 20rpx;
	}

	.box {
		width: 100%;
		padding: 0 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
		padding-bottom: 30rpx;
	}

	.form .line {
		font-size: 28rpx;
		line-height: 100rpx;
		border-bottom: 1px solid #D9D9DA;

	}

	.form .line .tit {
		color: #000;
		width: 116rpx;
		text-align-last: justify;
	}

	.form .line input,
	.form .line picker {
		color: #000;
		flex: 1;
		height: 100rpx;
		line-height: 100rpx;
		text-align: right;
	}


	.form .line.picker {
		padding-right: 30rpx;
		position: relative;
	}

	.form .line.picker::after {
		content: "\e61f";
		font-family: "iconfont";
		display: block;
		position: absolute;
		font-size: 24rpx;
		color: #b4b4b4;
		top: 0;
		right: 0rpx;
		line-height: 100rpx;
	}

	.form .line textarea {
		height: 60rpx;
		line-height: 1.4;
		width: 100%;
	}

	.bottom-box {
		width: 100%;
		padding-top: 60rpx;
		height: 224rpx;
		z-index: 10;

	}

	.btn-box {
		padding-top: 20rpx;
	}

	.btn-box .btn {
		width: 100%;
		height: 80rpx;
		border-radius: 10rpx;
		line-height: 80rpx;
		text-align: center;
		background-color: #347DFE;
		color: #fff;
		font-size: 32rpx;
	}
</style>
